package com.carsite.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**
 *  单据表
 * @struts.form include-all="false" extends="BaseForm"
 * @hibernate.class table="WT_Order"
 */
public class Order extends BaseObject implements Serializable {
	
	private Long orderId;//id
	
	private String orderNo;//单据编号 C20090101123 J20090101124
	
	private Integer type ;//种类 1出货单 2收货单
	
	private Integer status;//状态 1 开单 －1完结 
	
	private Set items; //明细
	
	private Date createTime;//生成时间
	
	private Date endTime;//结束时间
	
	private String outPerson;//出货人
	
	private Date outTime;//出货时间
	
	private String tranPerson;//送货人
	
	private String inPerson;//收货人
	
	private Date inTime;//收货时间
	

	/**
     * @struts.form-field form-name="OrderForm"
     * @hibernate.id column="Id" generator-class="increment" unsaved-value="null"
     */
	public Long getOrderId() {
		return orderId;
	}
	/**
	 * @struts.form-field form-name="OrderForm"
	 * 
	 * @hibernate.property  
	 */
	public Date getCreateTime() {
		return createTime;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public Date getEndTime() {
		return endTime;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public String getInPerson() {
		return inPerson;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public Date getInTime() {
		return inTime;
	}
  
	
	
	/**
	 * @hibernate.set	name="items" cascade="delete-orphan" inverse="true" lazy="false"
	 * @hibernate.one-to-many	 class="com.carsite.model.Item"
	 * @hibernate.collection-key column="order_Id"
	 * 
	 */
	public Set getItems() {
		return items;
	}

	
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public String getOutPerson() {
		return outPerson;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public Date getOutTime() {
		return outTime;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public Integer getStatus() {
		return status;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public String getTranPerson() {
		return tranPerson;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public Integer getType() {
		return type;
	}
	/**
	 * @struts.form-field form-name="OrderForm" 
	 * @hibernate.property  
	 */
	public String getOrderNo() {
		return orderNo;
	}
	
	
	
	
	
	
	

	
	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}
	public void setCreateTime(Date time) {
		createTime = time;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public void setInPerson(String inPerson) {
		this.inPerson = inPerson;
	}

	public void setInTime(Date inTime) {
		this.inTime = inTime;
	}

	public void setItems(Set items) {
		items = items;
	}

	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}

	public void setOutPerson(String outPerson) {
		this.outPerson = outPerson;
	}

	public void setOutTime(Date outTime) {
		this.outTime = outTime;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public void setTranPerson(String tranPerson) {
		this.tranPerson = tranPerson;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}
	public void addItem(Item item){
		Set items=this.getItems();
		if(null==items){
			items=new HashSet();
		}
		
		items.add(item);
		//item.setOrder(this);
	}

}
